﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Common_MasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            LoadTime();
            Page.Header.Title = "浙江农林大学教学建设项目管理系统";
        }
        
    }
    protected void LoadTime()
    {
        int nowtime = int.Parse(DateTime.Now.Hour.ToString());
        string welcome = "";
        string type="";
        if (nowtime >= 18)
        {
            welcome = "晚上好";
        }
        else if (nowtime >= 13)
        {
            welcome = "下午好";
        }
        else if (nowtime >= 12)
        {
            welcome = "中午好";
        }
        else if (nowtime >= 5)
        {
            welcome = "早上好";
        }
        else
        {
            welcome = "要注意休息，这个时间可不适合坐在电脑前面^_^";
        }
        if (Session["usertype"] == null || Session["name"]==null)
        {
            divnolog.InnerHtml = "<a href='../Index.aspx'>用户登陆</a>&nbsp;<a href='../Reg.aspx'>我要注册</a>&nbsp;" + welcome + "，您目前的权限为游客。";
        }
        else
        {
            switch (Session["usertype"].ToString())
            {
                case "1": type = "普通教师"; break;
                case "2": type = "学院管理员"; break;
                case "3": type = "项目管理员"; break;
                case "4": type = "系统管理员"; break;
                default: type = "未知权限"; break;
            }
            divnolog.InnerHtml = Session["name"].ToString()+"&nbsp;&nbsp;"+welcome+"，您目前的权限为"+type+"。";
        }
    }
}
